void main() {
  print('test future');
//  Future.delayed(Duration(seconds: 2), () {
//    print('time is up');
//    throw AssertionError('test error');
//  }).then((value) {
//    print('do next action');
//  }, onError: (e) {
//    print('some where wrong');
//  });

  Future.wait([
    Future.delayed(Duration(seconds: 2), () {
      print('first action');
      return 'first';
    }).then((value) {
      print('first then');
      return 'first then';
    }),
    Future.delayed(Duration(seconds: 1), () {
      print('second action finish');
      return 'second';
    })
  ]).then((value) {
    print('all actions are finish $value');
  });
}
